package com.example.Housekeeping.controller;


import com.example.Housekeeping.domain.HousekeepingUser;
import com.example.Housekeeping.service.HousekeepingUserService;
import com.example.JavaDemo.domain.Community;
import com.example.comon.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 接口文档访问地址 http://127.0.0.1:8089/swagger-  ui/index.html
 * apifox 导入接口数据 http://127.0.0.1:8089/v2/api-docs
 */
@RestController
@RequestMapping("/huoseservice")
@Api(value = "houseservice",tags = "家政服务")
public class HousekeepingController {
    @Autowired
    private HousekeepingUserService housekeepingUserService;

    @GetMapping("/getUserList")
    @ApiOperation("获取家政服务信息")
    public R<List<HousekeepingUser>> getUserList(HousekeepingUser housekeepingUser){
        List<HousekeepingUser> list =  housekeepingUserService.selectHousekeepingUser(housekeepingUser);
        return R.success(list);
    }



    @PostMapping("/addUser")
    @ApiOperation("增加家政服务")
    public R<HousekeepingUser> addHousekeepingUser(@RequestBody HousekeepingUser housekeepingUser){
        housekeepingUserService.insertHousekeepingUser(housekeepingUser);
        return R.success(housekeepingUser);
    }

    @PostMapping("/updateUserByAccount")
    @ApiOperation("修改id")
    public R<List<Community>> updateHousekeepingUserById(@RequestBody HousekeepingUser housekeepingUser){
        housekeepingUserService.updateHousekeepingUserById(housekeepingUser);
        return R.success();
    }

    @DeleteMapping("/delUserByAccount")
    @ApiOperation("删除服务信息")
    public R<List<Community>> delHousekeepingUserById(String id){
        housekeepingUserService.delHousekeepingUserById(id);
        return R.success();
    }
}


